import request from '@/utils/request'

// 获取商品类别
export function getCategoryDetails(query) {
  return request({
    url: '/categoryDetails',
    method: 'GET',
    params: query
  })
}
// 根据关键字获取商品类别
export function getDetailByKeyWords(query) {
  return request({
    url: '/categoryDetails/keywords',
    method: 'GET',
    params: query
  })
}
// 根据id获取商品类别
export function getCategoryDetailById(id) {
  return request({
    url: `/categoryDetail/${id}`,
    method: 'GET'
  })
}
// 添加商品明细
export function addCategoryDetail(data) {
  return request({
    url: '/categoryDetail/add',
    method: 'POST',
    data
  })
}
// 修改商品明细
export function updateCategoryDetail(data, id) {
  return request({
    url: `/categoryDetail/update/${id}`,
    method: 'PUT',
    data
  })
}
// 删除商品明细
export function deleteCategoryDetail(id) {
  return request({
    url:  `categoryDetail/delete/${id}`,
    method: 'PUT'
  })
}
export default {
  getCategoryDetails,
  getDetailByKeyWords,
  getCategoryDetailById,
  addCategoryDetail,
  updateCategoryDetail,
  deleteCategoryDetail
  
}